//
//  GDTimer.m
//  Gunterapple
//
//  Created by 热带雨林 on 2020/4/3.
//  Copyright © 2020 热带雨林. All rights reserved.
//

#import "GDTimer.h"

@interface GDTimer ()

@property (nonatomic, weak)id target;
@property (nonatomic, assign) SEL selector;

@end

@implementation GDTimer
+ (NSTimer *)scheduledTimerWithTimerInterval:(NSTimeInterval)interval withTarget:(id)target withSelector:(SEL)selector withUserInfo:(nullable id)userInfo withRepeats:(BOOL)yesOrNo{
    //创建当前的类对象
    GDTimer *timer = [[GDTimer alloc]init];
    timer.target = target;
    timer.selector = selector;
    return [NSTimer scheduledTimerWithTimeInterval:interval target:timer selector:@selector(fire:) userInfo:userInfo repeats:yesOrNo];
}
- (void)fire:(id)obj{
    //多线程使用
    [self.target performSelector:self.selector withObject:obj];
}
@end
